﻿using FluentNHibernate.Mapping;

namespace TaskKernel.Domain.Nhibernate.Mappings
{
    public class DepartmentUserMap : ClassMap<DepartmentUser>
    {
        public DepartmentUserMap()
        {
            Table("task_DepartmentUser");
            Id(x => x.UID, "GID").GeneratedBy.GuidNative();
            References(x => x.Department, "DepartmentGID");
            References(x => x.User, "AccountGID");
            Map(x => x.Role, "Role")
                .CustomType<EnumMapper<RoleEnum>>()
                .Not.Nullable();
        }
    }
}